/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package book.test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Enumeration;
import java.util.Hashtable;

/**
 *
 * @author Administrator
 */
public class HashtableDemo {
    public static void main(String[] args) throws IOException {
        Hashtable s = new Hashtable();
        s.put("约翰", new Integer(90));
        s.put("令狐冲", new Integer(100));
        s.put("小黄", new Integer(80));
        s.put("阿勒", new Integer(50));
        s.put("毕升", new Integer(90));
        Enumeration e = s.elements();
        while(e.hasMoreElements()){
            int temp = ((Integer)e.nextElement()).intValue();
            System.out.println(temp+"");
        }
        System.out.println();
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("请输入你要找的人：");
        String find = br.readLine();
        if(s.containsKey(find)){
            Integer temp=(Integer)(s.get(find));
            System.out.println(find+"的信息是："+temp.intValue());     
        }
        else{
            System.out.println("查无此人");
        }
    }

}
